package study.chapter03.jdk8.lambda;

interface MathUtil{
    int func(int x, int y);
}

public class LambdaDemo2 {
    public static void main(String[] args) {
        //加法
        MathUtil add = (x, y) -> {
            return x + y;
        };
        //减法
        MathUtil sub = (x, y) -> x - y;
        //乘法
        MathUtil mul = (x, y) -> x * y;
        //除法
        MathUtil div = (x, y) -> x / y;

        System.out.println("add：" + add.func(10, 20));
        System.out.println("sub：" + sub.func(10, 20));
        System.out.println("mul：" + mul.func(10, 20));
        System.out.println("div：" + div.func(10, 20));
    }
}
